package me.xiaolei.andlog.comm

import me.xiaolei.andlog.interceptor.IInterceptor
import me.xiaolei.andlog.prints.Print
import java.util.*

class InterceptorChain(
    var type: LogType,
    var tag: String,
    var obj: Any?,
    private val print: Print<Any?>,
    private val iterator: Iterator<IInterceptor>
)
{
    var time: Calendar = Calendar.getInstance()

    val msg: String get() = print.print(obj)

    fun proceed()
    {
        if (!iterator.hasNext())
        {
            return
        }
        val interceptor = iterator.next()
        interceptor.intercept(this)
    }
}